package nuc.edu.cn.controller;

import nuc.edu.cn.domain.ResponseResult;
import nuc.edu.cn.domain.User;
import nuc.edu.cn.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {
    @Autowired
    private LoginService loginService;
    @RequestMapping("/user/login")
    public ResponseResult xxlogin(@RequestBody User user){
        ResponseResult login = loginService.login(user);
        return login;
    }
    @RequestMapping("/user/logout")
    //ResponseResult是我们在domain目录写好的实体类
    public ResponseResult xxlogout(){
        return loginService.logout();
    }
}
